﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ThueCD : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            if (Session["GioHang"] != null)
            {
                DataTable dtb = (DataTable)Session["GioHang"];
                GridView5.DataSource = dtb;
                GridView5.DataBind();
            }
        }
    }
    ClassPhim cp = new ClassPhim();
    protected void GridView5_RowDeleting1(object sender, GridViewDeleteEventArgs e)
    {
        DataTable dtb = (DataTable)Session["GioHang"];
        dtb.Rows.RemoveAt(e.RowIndex);
        GridView5.DataSource = dtb;
        GridView5.DataBind();
    }
    protected void btnLuu_Click(object sender, EventArgs e)
    {
        DataTable dtb = (DataTable)Session["GioHang"];
        for (int i = 0; i < GridView5.Rows.Count; i++)
        {
            TextBox tbox = (TextBox)GridView5.Rows[i].Cells[1].FindControl("TextBox2");
            if (int.Parse(tbox.Text) < 1)
                Label1.Text = "Số lượng thuê ít nhất phải là 1";
            else
                dtb.Rows[i]["SoMuon"] = tbox.Text;
        }
        dtb.AcceptChanges();
        GridView5.DataSource = dtb;
        GridView5.DataBind();
    }
}
